import request from '@/utils/request'

// 获取商品一级分类接口
export function reqCategory1() {
  return request({
    method: 'get',
    url: `/admin/product/getCategory1`
  })
}
// 获取商品二级分类接口
export function reqCategory2(category1Id) {
  return request({
    method: 'get',
    url: `/admin/product/getCategory2/${category1Id}`
  })
}
// 获取商品三级分类接口
export function reqCategory3(category2Id) {
  return request({
    method: 'get',
    url: `/admin/product/getCategory3/${category2Id}`
  })
}

// 获取平台属性的接口
export function reqGetAttrList(category1Id, category2Id, category3Id) {
  // console.log('参数:', category1Id)
  // console.log('参数:', category2Id)
  // console.log('参数:', category3Id)
  return request({
    method: 'get',
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`
  })
}

// 添加属性与属性值接口
export function reqAddOrUpdateAttr(data) {
  console.log(data, 'data')
  return request({
    method: 'post',
    url: `/admin/product/saveAttrInfo`,
    data
  })
}

// 删除整条三级属性接口
export function reqDeleteAttr(attrId) {
  return request({
    method: 'delete',
    url: `/admin/product/deleteAttr/${attrId}`
  })
}
